<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>call、bind和apply</title>
</head>
<body>
    <script>

        function Person(name,age){
            this.name = name
            this.aeg = age
        }

        function Student1(name,age,sex) {
            Person.call(this,name,age)
            this.sex = sex
        }

        function Student2(name,age,sex){
           var bindThis = Person.bind(this,name,age)
           bindThis()
            this.sex = sex
        }

        function Student3(name,age,sex) {
            Person.apply(this,[name,age])
            this.sex = sex
        }

        let student1 = new Student1('zs',18,'男')
        let student2 = new Student2('ww',18,'男')
        let student3 = new Student3('zs',18,'男')

        console.log('student1=',student1);
        console.log('student2=',student2);
        console.log('student3=',student3);

    </script>
</body>
</html>